package com.xxx.reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * @version v1.0
 * @Description
 * @Author admin
 * @date 2021/7/26  9:47
 * @Copyright
 */
public class refDome01 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        Class<?> aClass = Class.forName("com.xxx.reflect.Student");
        //所有公共的构造方法

        Constructor<?> constructor1 = aClass.getConstructor();
//         constructor1 = aClass.getDeclaredConstructor();
//         for (Constructor<?>  constructor : constructor1) {
//             System.out.println();
//         }


        Constructor<?> constructor = aClass.getConstructor(String.class, int.class, String.class);
        Student student = (Student) constructor.newInstance("张三", 55, "男");
    }
}
